'''
Description: description
Author: 
LastEditors: M
'''
import os,json
import compoments.config as CFG
from compoments.config import PIKER_DIR,PROJECT_DIR,exp_config,setting_file
from compoments.params import load_params
from compoments.utils import _emphasis_,_warning_,_primary_


def show_info():
    file_nickname = [
        "Project directory",
        "Settings file",
        "Reference params file"
    ]
    file_check = [ 
        PROJECT_DIR,
        os.path.join(PIKER_DIR,setting_file),
        os.path.join(PIKER_DIR,exp_config),
     ]
    print(f"{_warning_('Piker version')}:",CFG.__version__)
    for nkn,fp in zip(file_nickname,file_check):
        if not os.path.exists(fp):
            print(f"{_warning_(nkn) }:{_emphasis_('NOT EXIST!')}-->{fp}")
        else:
            print(f"{_warning_(nkn)}:{fp}")
    
    P = load_params()
    print(f"{_warning_('Execute command')}:",end="")
    if CFG.exe_command_key in P:
        print(f"{_primary_(P[CFG.exe_command_key])}")
    else:
        print(f"{_emphasis_('NOT EXIST Params')} {_primary_(CFG.exe_command_key)} in {_primary_(file_nickname[2])}")

    print(_warning_("Piker configuration:"))

    print(_primary_("\tCOOL_TIME:"),CFG.COOL_TIME)
    print(_primary_("\tPARALLEL_CNT:"),CFG.PARALLEL_CNT)
    print(_primary_("\tPROCESS_INTERVAL:"),CFG.PROCESS_INTERVAL)
    print(_primary_("\tMAX_TASK_CNT:"),CFG.MAX_TASK_CNT)
